﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;

namespace Teigha.Core
{
	public class OdGiConveyorConnector : OdGiConveyorInput, OdGiConveyorOutput, IDisposable
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdGiConveyorConnector(IntPtr cPtr, bool cMemoryOwn)
		{
			this.swigCMemOwn = cMemoryOwn;
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdGiConveyorConnector obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdGiConveyorConnector()
		{
			this.Dispose();
		}

		public virtual void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							GlobalsPINVOKE.delete_OdGiConveyorConnector(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		HandleRef OdGiConveyorInput.GetCPtr()
		{
			return new HandleRef(this, GlobalsPINVOKE.OdGiConveyorConnector_OdGiConveyorInput_GetCPtr(this.swigCPtr.Handle));
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		HandleRef OdGiConveyorOutput.GetCPtr()
		{
			return new HandleRef(this, GlobalsPINVOKE.OdGiConveyorConnector_OdGiConveyorOutput_GetCPtr(this.swigCPtr.Handle));
		}

		public OdGiConveyorConnector() : this(GlobalsPINVOKE.new_OdGiConveyorConnector(), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void addSourceNode(OdGiConveyorOutput sourceNode)
		{
			GlobalsPINVOKE.OdGiConveyorConnector_addSourceNode(this.swigCPtr, sourceNode.GetCPtr());
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void removeSourceNode(OdGiConveyorOutput sourceNode)
		{
			GlobalsPINVOKE.OdGiConveyorConnector_removeSourceNode(this.swigCPtr, sourceNode.GetCPtr());
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void setDestGeometry(OdGiConveyorGeometry destGeometry)
		{
			GlobalsPINVOKE.OdGiConveyorConnector_setDestGeometry(this.swigCPtr, destGeometry.GetCPtr());
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual OdGiConveyorGeometry destGeometry()
		{
			OdGiConveyorGeometry_Internal result = new OdGiConveyorGeometry_Internal(GlobalsPINVOKE.OdGiConveyorConnector_destGeometry(this.swigCPtr), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGiConveyorGeometry geometry()
		{
			OdGiConveyorGeometry_Internal result = new OdGiConveyorGeometry_Internal(GlobalsPINVOKE.OdGiConveyorConnector_geometry(this.swigCPtr), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		private object locker = new object();

		private HandleRef swigCPtr;

		protected bool swigCMemOwn;
	}
}
